package edu.uwm.cs552;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;


/**
 * Render a terrain with a little icon showing the visual rendering of 
 * a terrain.
 */
public class HexBoardEditActionRenderer extends DefaultListCellRenderer {
	/**
	 * Keep Eclipse Happy
	 */
	private static final long serialVersionUID = 1L;

	public Component getListCellRendererComponent(JList list,
			Object value,
			int index,
			boolean isSelected,
			boolean hasFocus) {
		final HexBoardEditAction editAction = (HexBoardEditAction)value;
		JLabel label =
			(JLabel)super.getListCellRendererComponent(list,
					editAction.getLabel(),
					index,
					isSelected,
					hasFocus);
		label.setIcon(editAction.getIcon());
		return(label);
	}
}
